<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title></title>
    <script src='./vue.global.js'></script>
</head>
<body>
    <div id='app'>
        <!-- 防抖处理：等用户输入告一段落时才同步msg (回车或光标点击别处) -->
        <p>msg: {{msg}}</p>
        <input type="text" v-model.lazy="msg">
        <hr>

        <!-- 帮用户的输入修剪头尾空白 -->
        <p>name: {{name}} / {{nameLength}}</p>
        <input type="text" v-model.trim="name">
        <hr>

        <!-- 将用户在input框中的输入转换为number类型 -->
        <p>name: {{age}} / {{ageType}}</p>
        <input type="text" v-model.number="age">

    </div>

    <script>
        Vue.createApp({
            data(){
                return {
                    msg:"你老婆跟人跑了",
                    name:"法外狂徒张三",
                    age:18
                }
            },
            computed:{
                nameLength(){
                    return this.name.length
                },

                ageType(){
                    return typeof(this.age)
                }
            }
        }).mount('#app')

    </script>
</body>
</html>